package com.qy.mybatisplus.service.impl;

import com.qy.mybatisplus.entity.User;
import com.qy.mybatisplus.mapper.UserMapper;
import com.qy.mybatisplus.service.MPUserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author qy
 * @since 2019-12-10
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements MPUserService {


    @Autowired
    private UserMapper userMapper;

    @Transactional
    public Boolean increaseNoSafe(User u) {
        try {
            User user = userMapper.getById(u.getId());
            user.setUserName("aaaa");
            return userMapper.updateNoSafe(user);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}
